package com.aplink.generic.constant.type;

public enum DialogStatus {
    CONFIRM(0x2001, "Confirm"),
    ENABLE_CONDITON_FAILED(0x2007, "EnableConditionFailed"),
    FAILD(0x2003, "Failed"),
    HTTP_FAILED(0x2006, "HttpFailed"),
    INVALID_TOKEN(0x2004, "InvalidToken"),
    INVALID_VALIDATION(0x2008, "InvalidValidation"),
    NO_INTERNET_ACCESS(0x2005, "NoInternetAccess"),
    SUCCESSFUL(0x2002, "Successful");

    public static DialogStatus get(final int key) {
        for (final DialogStatus dialogRule : DialogStatus.values()) {
            if (dialogRule.getCode() == key) {
                return dialogRule;
            }
        }
        return null;
    }

    public static DialogStatus get(final String key) {
        for (final DialogStatus dialogRule : DialogStatus.values()) {
            if (dialogRule.getValue().equals(key)) {
                return dialogRule;
            }
        }
        return null;
    }

    private int mCode;

    private String mValue;

    private DialogStatus(final int code, final String value) {
        this.mValue = value;
        setCode(code);
    }

    public int getCode() {
        return this.mCode;
    }

    public String getValue() {
        return this.mValue;
    }

    public void setCode(final int code) {
        this.mCode = code;
    }

    public void setValue(final String value) {
        this.mValue = value;
    }
}
